<template>
  <div>
    <!-- 面包屑区域 -->
    <Breadcrumb></Breadcrumb>
    <el-card>
      <el-table :data="rightsList" style="width: 100%" border stripe>
        <el-table-column type="index" label="#" width="60"> </el-table-column>
        <el-table-column prop="authName" label="权限名称"> </el-table-column>
        <el-table-column prop="path" label="路径"> </el-table-column>
        <el-table-column prop="level" label="权限等级">
          <template v-slot="scope">
            <el-tag v-if="scope.row.level === '0'">一级</el-tag>
            <el-tag type="success" v-else-if="scope.row.level === '1'"
              >二级</el-tag
            >
            <el-tag type="warning" v-else>三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>
<script>
import Breadcrumb from "../Breadcrumb";
import { getRightsData } from '@/request/rolesAPI'
export default {
  components: {
    Breadcrumb,
  },
  data() {
    return {
      // 获取所有权限数据
      rightsList: [],
    };
  },
  created() {
    this.getRightsList();
  },
  methods: {
    async getRightsList() {
      let { data: res } = await getRightsData();
      if (res.meta.status !== 200) return this.$message.error(res.meta.msg);
      this.rightsList = res.data;
      //   console.log(this.rightsList);
    },
  },
};
</script>
<style lang="scss" scoped>
</style>